#include "StdAfx.h"
#include "Astuff.h"
#include "Aobj.h"
#include "Alog.h"


Aobj::Aobj(bool stuff)
{
	if( stuff )
		mastuff = new Astuff(this);
	else
		mastuff = NULL;
}
Aobj::~Aobj(void)
{
	//adestory();
	if( mastuff ) { delete mastuff; mastuff = NULL; }
}
int Aobj::checkStuff()
{
	int d = 0;
	if (!mastuff)
	{
		Alog::s_out(_T("->Aobj.checkStuff() = NULL.\r\n"));
		d = -1;
	}
	VERIFY(mastuff);
	return d;
}

int Aobj::acreate()
{
	checkStuff();
	return mastuff->acreate();
}
void Aobj::adestory()
{
	checkStuff();
	mastuff->adestory();
}
const TCHAR *Aobj::getObjName()
{
	checkStuff();

	return mastuff->getObjName();
}
void Aobj::setObjName( const TCHAR * str)
{
	checkStuff();

	mastuff->setObjName(str);
}
// ---------automation-----------------------
int Aobj::ainit()
{
	checkStuff();
	return mastuff->ainit();
}
void Aobj::aexit()
{
	checkStuff();
	return mastuff->aexit();
}
// --------------------------------------------------------
int Aobj::areset()
{
	checkStuff();
	return mastuff->areset();
}
// ---------run control for multip thread------------------
int Aobj::astart()
{
	checkStuff();
	return mastuff->astart();
}
void Aobj::astop()
{
	checkStuff();
	mastuff->astop();
}
bool Aobj::isrun()
{
	checkStuff();

	return mastuff->isrun();
}